#ifndef EVENTCATCHER_H_
#define EVENTCATCHER_H_

#include "irrlicht.h"
#include <iostream>
#include <exception>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "Handlers/EventHandler.h"

using namespace irr;

class EventCatcher : public IEventReceiver {
	protected:
		IrrlichtDevice* m_device;
		std::vector<boost::shared_ptr<EventHandler> > m_eventHandlers;
	public:
		EventCatcher(IrrlichtDevice *device);
		bool OnEvent(const SEvent& event);
		bool RegisterEventHandler(boost::shared_ptr<EventHandler>& newhandler) {
			try {
				m_eventHandlers.push_back(newhandler);
				return true;
			}
			catch(std::exception& e) {
				std::cout<<"Standard exception: "<<e.what()<<std::endl;
				return false;
			}
		}
		virtual ~EventCatcher();
};

#endif /*EVENTCATCHER_H_*/
